DAY7:Count by X


Posted by birdbirdmurmur on 2023-07-20

題目連結:

Count by X

思考邏輯:

1.總共有n個數字,
2.每個數字都要乘上x
3.塞進z陣列

解法:

function countBy(x, n) {
  let z = [];
  for (let i=1; i<=n ;i++){
    z.push(x*i)
  }
  return z;
}

#javascript #Codewars







Related Posts

[筆記] 資料格式的選擇 XML 和 JSON

[筆記] 資料格式的選擇 XML 和 JSON

滑動到看不見某個元件,另一個就會元件出現的效果

滑動到看不見某個元件,另一個就會元件出現的效果

透過網路交換資料的方式(SOAP 和 RESTful API)

透過網路交換資料的方式(SOAP 和 RESTful API)


Comments